<template>
  <div class="login-page">
    <!-- 动态背景 -->
    <div class="animated-bg">
      <div class="gradient-layer"></div>
      <div class="particle-container">
        <div v-for="i in 20" :key="i" class="particle" :style="getRandomParticleStyle()"></div>
      </div>
      <div class="wave-container">
        <svg class="wave" viewBox="0 0 1440 320" preserveAspectRatio="none">
          <path fill="rgba(255,255,255,0.03)" d="M0,192L48,170.7C96,149,192,107,288,122.7C384,139,480,213,576,224C672,235,768,181,864,149.3C960,117,1056,107,1152,128C1248,149,1344,203,1392,229.3L1440,256L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path>
        </svg>
        <svg class="wave" viewBox="0 0 1440 320" preserveAspectRatio="none">
          <path fill="rgba(255,255,255,0.05)" d="M0,64L48,80C96,96,192,128,288,160C384,192,480,224,576,229.3C672,235,768,213,864,181.3C960,149,1056,107,1152,90.7C1248,75,1344,85,1392,90.7L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path>
        </svg>
      </div>
    </div>

    <!-- 主内容 -->
    <div class="content-container">
      <!-- 左侧信息区域 -->
      <div class="info-section">
        <div class="brand-container">
          <div class="brand-logo">
            <span>E</span>
          </div>
          <h1 class="brand-name">E特尔诺</h1>
        </div>
        
        <div class="info-tagline">
          <h2>API管理平台</h2>
          <div class="artistic-quote">
            <span class="quote-mark">"</span>
            <span class="quote-text">热爱的事，永不过时</span>
            <span class="quote-mark">"</span>
          </div>
        </div>
        
        <div class="feature-list">
          <div class="feature-item">
            <div class="feature-icon">
              <i class="fas fa-rocket"></i>
            </div>
            <div class="feature-text">
              <h3>高效管理</h3>
              <p>便捷管理您的API接口与文档</p>
            </div>
          </div>
          
          <div class="feature-item">
            <div class="feature-icon">
              <i class="fas fa-shield-alt"></i>
            </div>
            <div class="feature-text">
              <h3>安全可靠</h3>
              <p>多重安全保障，数据无忧</p>
            </div>
          </div>
          
          <div class="feature-item">
            <div class="feature-icon">
              <i class="fas fa-sync"></i>
            </div>
            <div class="feature-text">
              <h3>实时更新</h3>
              <p>接口状态实时监控与更新</p>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 右侧表单区域 -->
      <div class="form-section">
        <div class="form-container">
          <div class="form-header">
            <div class="form-tabs">
              <button 
                :class="['tab-btn', { active: activeTab === 'login' }]"
                @click="switchTab('login')"
              >
                <i class="fas fa-sign-in-alt"></i>
                <span>登录</span>
              </button>
              <button 
                :class="['tab-btn', { active: activeTab === 'register' }]"
                @click="switchTab('register')"
              >
                <i class="fas fa-user-plus"></i>
                <span>注册</span>
              </button>
            </div>
          </div>
          
          <!-- 表单内容 -->
          <transition name="fade-slide" mode="out-in">
            <!-- 登录表单 -->
            <div v-if="activeTab === 'login'" class="form-content" key="login">
              <el-form ref="loginForm" :model="loginForm" :rules="loginRules" label-position="left" label-width="70px">
                <el-form-item label="账号" prop="account">
                  <div class="input-with-icon">
                    <div class="form-icon">
                      <i class="fas fa-user"></i>
                    </div>
                    <el-input 
                      v-model="loginForm.account"
                      placeholder="请输入账号"
                    ></el-input>
                  </div>
                </el-form-item>

                <el-form-item label="密码" prop="password">
                  <div class="input-with-icon">
                    <div class="form-icon">
                      <i class="fas fa-lock"></i>
                    </div>
                    <el-input
                      :type="showPassword ? 'text' : 'password'"
                      v-model="loginForm.password"
                      placeholder="请输入密码"
                      @keyup.enter.native="submitForm('loginForm')"
                    >
                      <template #suffix>
                        <i 
                          :class="['fas', showPassword ? 'fa-eye-slash' : 'fa-eye']"
                          @click="togglePasswordVisibility"
                        ></i>
                      </template>
                    </el-input>
                  </div>
                </el-form-item>

                <div class="form-options">
                  <el-checkbox v-model="rememberMe">记住我</el-checkbox>
                  <a href="#" class="forgot-password">忘记密码？</a>
                </div>

                <el-button 
                  type="primary" 
                  class="submit-btn"
                  :loading="isSubmitting"
                  @click="submitForm('loginForm')"
                >
                  <span class="btn-content">
                    <span>{{ isSubmitting ? '登录中...' : '登录' }}</span>
                    <i class="fas fa-arrow-right"></i>
                  </span>
                </el-button>
              </el-form>
            </div>

            <!-- 注册表单 -->
            <div v-else class="form-content" key="register">
              <el-form ref="registerForm" :model="registerForm" :rules="registerRules" label-position="left" label-width="80px">
                <el-form-item label="用户名" prop="username">
                  <div class="input-with-icon">
                    <div class="form-icon">
                      <i class="fas fa-user"></i>
                    </div>
                    <el-input 
                      v-model="registerForm.username"
                      placeholder="请输入用户名"
                    ></el-input>
                  </div>
                </el-form-item>

                <el-form-item label="账号" prop="account">
                  <div class="input-with-icon">
                    <div class="form-icon">
                      <i class="fas fa-id-card"></i>
                    </div>
                    <el-input 
                      v-model="registerForm.account"
                      placeholder="请输入账号"
                    ></el-input>
                  </div>
                </el-form-item>

                <el-form-item label="邮箱" prop="email">
                  <div class="input-with-icon">
                    <div class="form-icon">
                      <i class="fas fa-envelope"></i>
                    </div>
                    <el-input 
                      v-model="registerForm.email"
                      placeholder="请输入邮箱"
                    ></el-input>
                  </div>
                </el-form-item>

                <el-form-item label="密码" prop="password">
                  <div class="input-with-icon">
                    <div class="form-icon">
                      <i class="fas fa-lock"></i>
                    </div>
                    <el-input
                      :type="showPassword ? 'text' : 'password'"
                      v-model="registerForm.password"
                      placeholder="请输入密码"
                    >
                      <template #suffix>
                        <i 
                          :class="['fas', showPassword ? 'fa-eye-slash' : 'fa-eye']"
                          @click="togglePasswordVisibility"
                        ></i>
                      </template>
                    </el-input>
                  </div>
                </el-form-item>

                <el-form-item label="确认密码" prop="confirmPassword">
                  <div class="input-with-icon">
                    <div class="form-icon">
                      <i class="fas fa-lock"></i>
                    </div>
                    <el-input
                      :type="showPassword ? 'text' : 'password'"
                      v-model="registerForm.confirmPassword"
                      placeholder="请再次输入密码"
                    ></el-input>
                  </div>
                </el-form-item>

                <el-form-item label="验证码" prop="code">
                  <div class="input-with-icon verification-code">
                    <div class="form-icon">
                      <i class="fas fa-shield-alt"></i>
                    </div>
                    <el-input 
                      v-model="registerForm.code"
                      placeholder="请输入验证码"
                    >
                      <template #append>
                        <el-button 
                          :disabled="cooldown > 0" 
                          @click="getVerificationCode"
                          class="code-button"
                        >
                          {{ cooldown > 0 ? `${cooldown}秒后重试` : '获取验证码' }}
                        </el-button>
                      </template>
                    </el-input>
                  </div>
                </el-form-item>

                <el-button 
                  type="primary" 
                  class="submit-btn"
                  :loading="isSubmitting"
                  @click="submitForm('registerForm')"
                >
                  <span class="btn-content">
                    <span>{{ isSubmitting ? '注册中...' : '注册' }}</span>
                    <i class="fas fa-arrow-right"></i>
                  </span>
                </el-button>
              </el-form>
            </div>
          </transition>
          
          <!-- 版权信息 -->
          <div class="copyright">
            <p>&copy; {{ new Date().getFullYear() }} E特尔诺. All rights reserved.</p>
          </div>
        </div>
      </div>
    </div>

    <!-- 全局提示 -->
    <div class="toast" :class="{ 'show': showToast }">
      {{ toastMessage }}
    </div>
  </div>
</template>

<script>
import axios from 'axios';

export default {
  name: 'LoginPage',
  data() {
    // 密码确认验证
    const validatePass = (rule, value, callback) => {
      if (value !== this.registerForm.password) {
        callback(new Error('两次输入密码不一致!'));
      } else {
        callback();
      }
    };

    return {
      activeTab: 'login',
      showPassword: false,
      isSubmitting: false,
      rememberMe: false,
      
      // 登录表单
      loginForm: {
        account: '',
        password: ''
      },
      
      // 注册表单
      registerForm: {
        username: '',
        account: '',
        email: '',
        password: '',
        confirmPassword: '',
        code: ''
      },
      
      // 登录验证规则
      loginRules: {
        account: [
          { required: true, message: '请输入账号', trigger: 'blur' }
        ],
        password: [
          { required: true, message: '请输入密码', trigger: 'blur' },
          { min: 6, message: '密码长度不能小于6位', trigger: 'blur' }
        ]
      },
      
      // 注册验证规则
      registerRules: {
        username: [
          { required: true, message: '请输入用户名', trigger: 'blur' },
          { min: 2, message: '用户名长度不能小于2位', trigger: 'blur' }
        ],
        account: [
          { required: true, message: '请输入账号', trigger: 'blur' },
          { min: 5, message: '账号长度不能小于5位', trigger: 'blur' },
          { pattern: /^[a-zA-Z0-9_]+$/, message: '账号只能包含字母、数字和下划线', trigger: 'blur' }
        ],
        email: [
          { required: true, message: '请输入邮箱地址', trigger: 'blur' },
          { type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }
        ],
        password: [
          { required: true, message: '请输入密码', trigger: 'blur' },
          { min: 6, message: '密码长度不能小于6位', trigger: 'blur' }
        ],
        confirmPassword: [
          { required: true, message: '请再次输入密码', trigger: 'blur' },
          { validator: validatePass, trigger: 'blur' }
        ],
        code: [
          { required: true, message: '请输入验证码', trigger: 'blur' },
          { min: 6, max: 6, message: '验证码长度应为6位', trigger: 'blur' }
        ]
      },
      
      // 提示相关
      showToast: false,
      toastMessage: '',
      
      // 动画相关
      cooldown: 0,
      timer: null
    };
  },
  
  methods: {
    // 表单提交
    async submitForm(formName) {
      try {
        await this.$refs[formName].validate();
        this.isSubmitting = true;
        
        const apiEndpoint = formName === 'loginForm' ? '/api/admin/login' : '/api/register';
        const params = formName === 'loginForm' ? {
          account: this.loginForm.account,
          password: this.loginForm.password
        } : {
          username: this.registerForm.username,
          account: this.registerForm.account,
          email: this.registerForm.email,
          password: this.registerForm.password,
          code: this.registerForm.code
        };

        const response = await axios.post(apiEndpoint, params);
        
        if (response.data.code === 20002 || response.data.code === 200) {
          if (formName === 'loginForm') {
            localStorage.setItem('token', response.data.data);
            localStorage.setItem('account', response.data.currentMode);
            this.$router.replace('/control-center');
            this.showToastMessage('登录成功');
          } else {
            this.showToastMessage('注册成功，请登录');
            this.activeTab = 'login';
          }
        } else {
          throw new Error(response.data.message);
        }
      } catch (error) {
        this.showToastMessage(error.message || (formName === 'loginForm' ? '登录失败' : '注册失败'));
      } finally {
        this.isSubmitting = false;
      }
    },

    // 切换密码可见性
    togglePasswordVisibility() {
      this.showPassword = !this.showPassword;
    },

    // 显示提示消息
    showToastMessage(message) {
      this.toastMessage = message;
      this.showToast = true;
      setTimeout(() => {
        this.showToast = false;
      }, 3000);
    },

    // 切换标签页
    switchTab(tab) {
      this.activeTab = tab;
    },

    // 获取验证码
    async getVerificationCode() {
      try {
        // 先验证邮箱
        await this.$refs.registerForm.validateField('email');
        
        // 开始倒计时
        this.cooldown = 60;
        this.startCooldown();
        
        // 调用获取验证码接口
        const response = await axios.post('/api/verificationCode', {
          email: this.registerForm.email
        });
        
        if (response.data.code === 200) {
          this.showToastMessage('验证码已发送至您的邮箱');
        } else {
          throw new Error(response.data.message || '验证码发送失败');
        }
      } catch (error) {
        this.showToastMessage(error.message || '验证码发送失败');
        this.cooldown = 0;
        clearInterval(this.timer);
      }
    },
    
    // 倒计时方法
    startCooldown() {
      clearInterval(this.timer);
      this.timer = setInterval(() => {
        if (this.cooldown > 0) {
          this.cooldown--;
        } else {
          clearInterval(this.timer);
        }
      }, 1000);
    },
    
    // 生成随机粒子样式
    getRandomParticleStyle() {
      const size = Math.random() * 30 + 10;
      const x = Math.random() * 100;
      const y = Math.random() * 100;
      const delay = Math.random() * 5;
      const duration = Math.random() * 20 + 10;
      
      return {
        width: `${size}px`,
        height: `${size}px`,
        left: `${x}%`,
        top: `${y}%`,
        animationDelay: `${delay}s`,
        animationDuration: `${duration}s`
      };
    }
  },
  
  mounted() {
    document.title = 'E特尔诺-登录';
  },
  
  beforeDestroy() {
    clearInterval(this.timer);
  }
};
</script>

<style scoped>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Ma+Shan+Zheng&family=Noto+Serif+SC:wght@400;700&display=swap');

/* 基础样式 */
.login-page {
  min-height: 100vh;
  background: #0f172a;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  font-family: 'Poppins', 'Noto Serif SC', sans-serif;
}

/* 动态背景 */
.animated-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.gradient-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  opacity: 0.8;
}

/* 粒子效果 */

  
.particle-container {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3), transparent);
  opacity: 0.2;
  animation: float-particle infinite linear;
}

/* 波浪效果 */
.wave-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
}

.wave {
  width: 100%;
  height: 150px;
  position: absolute;
  bottom: 0;
}

.wave:nth-child(1) {
  animation: wave-animation 25s linear infinite;
}

.wave:nth-child(2) {
  animation: wave-animation 15s linear infinite reverse;
}

/* 主内容容器 */
.content-container {
  width: 90%;
  max-width: 1200px;
  display: flex;
  position: relative;
  z-index: 1;
  margin: 2rem;
  gap: 30px;
}

/* 左侧信息区域 */
.info-section {
  flex: 1;
  color: white;
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-container {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
}

.brand-logo {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.brand-logo span {
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
}

.brand-name {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 0;
}

.info-tagline {
  margin-bottom: 3rem;
}

.info-tagline h2 {
  font-size: 1.8rem;
  font-weight: 500;
  margin: 0 0 1.5rem 0;
  color: rgba(255, 255, 255, 0.9);
}

.artistic-quote {
  position: relative;
  font-family: 'Ma Shan Zheng', 'Noto Serif SC', serif;
  font-size: 2.2rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.95);
  margin: 2rem 0;
}

.quote-mark {
  font-size: 3rem;
  color: rgba(59, 130, 246, 0.6);
  position: relative;
  top: 10px;
}

.quote-text {
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 0 5px;
}

/* 特性列表 */
.feature-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.feature-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
}

.feature-icon {
  width: 50px;
  height: 50px;
  background: rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #3b82f6;
}

.feature-text {
  flex: 1;
}

.feature-text h3 {
  margin: 0 0 0.3rem 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.feature-text p {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

/* 右侧表单区域 */
.form-section {
  width: 450px;
  display: flex;
  align-items: center;
}

.form-container {
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* 表单头部 */
.form-header {
  margin-bottom: 2rem;
}

.form-tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 1rem;
}

.tab-btn {
  flex: 1;
  padding: 0.8rem;
  border: none;
  background: none;
  color: #6b7280;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  border-radius: 8px;
}

.tab-btn i {
  font-size: 1.1rem;
}

.tab-btn.active {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.tab-btn:hover:not(.active) {
  background: rgba(0, 0, 0, 0.05);
}

/* 表单标签样式 */
.el-form-item__label {
  font-size: 0.9rem;
  color: #374151;
  font-weight: 500;
  text-align: right !important;
  line-height: 40px;
  padding: 0 12px 0 0;
}

/* 表单项间距调整 */
.el-form-item {
  margin-bottom: 20px;
}

/* 输入框与图标组合样式 */
.input-with-icon {
  display: flex;
  align-items: center;
  position: relative;
}

.form-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 10px 0 0 10px;
  border: 1px solid #e5e7eb;
  border-right: none;
  color: #6b7280;
}

.input-with-icon .el-input .el-input__inner {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  height: 40px;
  border-color: #e5e7eb;
}

/* 表单选项位置调整 */
.form-options {
  padding-left: 70px; /* 与标签宽度一致 */
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 0 1.5rem;
}

/* 提交按钮位置调整 */
.submit-btn {
  margin-left: 70px; /* 与标签宽度一致 */
  width: calc(100% - 70px);
}

/* 验证码输入框特殊处理 */
.verification-code .el-input-group__append {
  padding: 0;
  background: transparent;
}

.code-button {
  height: 40px;
  font-size: 0.9rem;
  padding: 0 15px;
  border-radius: 0 4px 4px 0;
  background: #3b82f6;
  color: white;
  border: none;
}

/* 响应式调整 */
@media (max-width: 480px) {
  .el-form-item__label {
    padding: 0 8px 0 0;
    font-size: 0.85rem;
  }
  
  .form-icon {
    width: 36px;
    height: 36px;
  }
  
  .input-with-icon .el-input .el-input__inner {
    height: 36px;
  }
  
  .code-button {
    height: 36px;
    font-size: 0.8rem;
    padding: 0 8px;
  }
  
  .form-options {
    padding-left: 70px;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }
}

/* 版权信息 */
.copyright {
  margin-top: 2rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.8rem;
}

/* Toast提示 */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 23, 42, 0.9);
  color: white;
  padding: 1rem 2rem;
  border-radius: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  visibility: hidden;
  backdrop-filter: blur(5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  z-index: 9999;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* 动画效果 */
@keyframes wave-animation {
  0% { transform: translateX(0); }
  50% { transform: translateX(-25%); }
  100% { transform: translateX(0); }
}

@keyframes float-particle {
  0% {
    transform: translateY(0) rotate(0);
    opacity: 0;
  }
  20% {
    opacity: 0.2;
  }
  80% {
    opacity: 0.2;
  }
  100% {
    transform: translateY(-150px) rotate(360deg);
    opacity: 0;
  }
}

/* 淡入淡出动画 */
.fade-slide-enter-active,
.fade-slide-leave-active {
  transition: all 0.3s;
}

.fade-slide-enter,
.fade-slide-leave-to {
  opacity: 0;
  transform: translateY(10px);
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .content-container {
    flex-direction: column;
    max-width: 600px;
  }
  
  .info-section, .form-section {
    width: 100%;
  }
  
  .info-section {
    padding: 2rem 1rem;
  }
  
  .artistic-quote {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .content-container {
    margin: 1rem;
  }
  
  .brand-name {
    font-size: 2rem;
  }
  
  .info-tagline h2 {
    font-size: 1.5rem;
  }
  
  .artistic-quote {
    font-size: 1.8rem;
  }
  
  .feature-list {
    gap: 1rem;
  }
  
  .form-container {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .brand-container {
    margin-bottom: 1.5rem;
  }
  
  .brand-logo {
    width: 50px;
    height: 50px;
  }
  
  .brand-logo span {
    font-size: 2rem;
  }
  
  .brand-name {
    font-size: 1.8rem;
  }
  
  .artistic-quote {
    font-size: 1.5rem;
    margin: 1.5rem 0;
  }
  
  .quote-mark {
    font-size: 2.5rem;
  }
  
  .feature-item {
    padding: 0.8rem;
  }
  
  .feature-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .feature-text h3 {
    font-size: 1rem;
  }
  
  .feature-text p {
    font-size: 0.8rem;
  }
  
  .form-tabs {
    gap: 0.5rem;
  }
  
  .tab-btn {
    padding: 0.6rem;
    font-size: 0.9rem;
  }
  
  .form-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }
  
  .form-icon {
    width: 38px;
    height: 38px;
  }
  
  .input-with-icon .el-input .el-input__inner {
    height: 38px;
  }
  
  .code-button {
    height: 38px;
    font-size: 0.8rem;
    padding: 0 10px;
  }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
  .form-container {
    background: rgba(30, 41, 59, 0.95);
  }
  
  .el-form-item__label {
    color: #e2e8f0;
  }
  
  .form-tabs {
    border-bottom-color: #334155;
  }
  
  .tab-btn {
    color: #94a3b8;
  }
  
  .tab-btn.active {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
  }
  
  .form-icon {
    background: #334155;
    border-color: #475569;
    color: #94a3b8;
  }
  
  .input-with-icon .el-input .el-input__inner {
    border-color: #475569;
    background: #1e293b;
    color: #e2e8f0;
  }
  
  .forgot-password {
    color: #60a5fa;
  }
  
  .submit-btn {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  }
  
  .copyright {
    color: #94a3b8;
  }
}
</style>